/*
* @Author: Administrator
* @Date:   2018-09-12 18:25:40
* @Last Modified by:   Administrator
* @Last Modified time: 2018-09-12 19:32:08
*/
import { fromJS } from 'immutable'
import * as constants from './constants.js';
//将在immutable中一如的fromJS 抱在这个对象外面使得这个普通对象变化为一个immutable对象
const defaultState = fromJS({
  title: '',
  content: ''
})
//将if用switch case做替换
export default (state = defaultState, action) => {
	 switch(action.type){
     case constants.GET_DETAILS:
     return state.merge({
     	title: fromJS(action.title),
     	content: fromJS(action.content)
     })
	 	default:
	 	 return state;
	 	}
 }
